import { rcaNumberFormat } from './common.js'
import { commonTableOption } from './common.js'
import { dateFormat } from '@/util/date';
export const confirmStatus = [
  {
    label: '未确认',
    value: '0'
  }, {
    label: '已确认',
    value: '1'
  }
]

export const tableOption = {
  ...commonTableOption,
  selection: true,
  height: 500,
  selectable: (row, index) => {
    return (
      row.confirmStatus === '0'
    );
  },
  column: [
    {
      hide: true,
      type: 'month',
      label: '日期',
      prop: 'tradeDate',
      search: true,
      searchValue: dateFormat(new Date(), 'yyyy-MM-dd'),
      valueFormat: 'yyyy-MM-dd',
    },
    {
      type: 'date',
      label: '日期',
      prop: 'tradeTime',
    }, {
      type: 'select',
      label: '票种',
      prop: 'ticketType',
      search: true,
      dicUrl: '/rca/swckelectronicreceipt/ticketType',
      props: {
        label: 'name',
        value: 'code'
      },
    }, {
      label: '营销车票售卖',
      children: [/*{
        type: 'input',
        label: '线下核销',
        children: [{
          type: 'input',
          showSummary: true,
          precision: 2,
          formatter: (row, value, label, column) => {
            return rcaNumberFormat(value, true)
          },
          label: '售卖金额',
          prop: 'offlineSellAmount'
        }, {
          type: 'input',
          showSummary: true,
          precision: 2,
          formatter: (row, value, label, column) => {
            return rcaNumberFormat(value, true)
          },
          label: '银行电子回执单金额',
          prop: 'offlineBankReceipts'
        }]
      }, */{
        type: 'input',
        label: '转账',
        children: [{
          type: 'input',
          showSummary: true,
          precision: 2,
          formatter: (row, value, label, column) => {
            return rcaNumberFormat(value, true)
          },
          label: '售卖金额',
          prop: 'transferSellAmount'
        }, {
          type: 'input',
          showSummary: true,
          precision: 2,
          formatter: (row, value, label, column) => {
            return rcaNumberFormat(value, true)
          },
          width: "150px",
          label: '银行电子回执单金额',
          prop: 'transferBankReceipts'
        },]
      }, {
        type: 'input',
        label: '团购售卖',
        children: [{
          type: 'input',
          showSummary: true,
          precision: 2,
          formatter: (row, value, label, column) => {
            return rcaNumberFormat(value, true)
          },
          label: '现金支付',
          prop: 'groupPurchaseCash'
        }, {
          type: 'input',
          showSummary: true,
          precision: 2,
          formatter: (row, value, label, column) => {
            return rcaNumberFormat(value, true)
          },
          label: '微信支付',
          prop: 'groupPurchaseWechat'
        }, {
          type: 'input',
          showSummary: true,
          precision: 2,
          formatter: (row, value, label, column) => {
            return rcaNumberFormat(value, true)
          },
          label: '支付宝支付',
           width: "120px",
          prop: 'groupPurchaseAlipay'
        }, {
          type: 'input',
          showSummary: true,
          precision: 2,
          formatter: (row, value, label, column) => {
            return rcaNumberFormat(value, true)
          },
          label: '银行转账',
          prop: 'groupPurchaseBankTransfer'
        }, {
          type: 'input',
          showSummary: true,
          precision: 2,
          formatter: (row, value, label, column) => {
            return rcaNumberFormat(value, true)
          },
          label: '合计金额',
          prop: 'groupPurchaseTotal'
        }, {
          type: 'input',
          showSummary: true,
          precision: 2,
          formatter: (row, value, label, column) => {
            return rcaNumberFormat(value, true)
          },
           width: "150px",
          label: '银行电子回执单金额',
          prop: 'groupPurchaseBankReceipts'
        }]
      }, {
        type: 'input',
        label: '差异（交易-电子回执单）',
        children: [/*{
          type: 'input',
          showSummary: true,
          precision: 2,
          formatter: (row, value, label, column) => {
            return rcaNumberFormat(value, true)
          },
          label: '线下核销',
          prop: 'diffOfflineTicket'
        }, */{
          type: 'input',
          showSummary: true,
          precision: 2,
          formatter: (row, value, label, column) => {
            return rcaNumberFormat(value, true)
          },
          label: '转账',
          prop: 'diffTransferTicket'
        }, {
          type: 'input',
          showSummary: true,
          precision: 2,
          formatter: (row, value, label, column) => {
            return rcaNumberFormat(value, true)
          },
          label: '团购售卖',
          prop: 'diffGroupSell'
        }]
      },
      ]
    }, {
      type: 'select',
      label: '确认状态',
      prop: 'confirmStatus',
      dicData: confirmStatus,
      search: true,
    }]
}
